package com.sdgakj.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.persistence.*;
import java.io.Serializable;

@Entity
@Table(name="f_districts")
@NamedQuery(name="ShtDistrict.findAll", query="SELECT t FROM ShtDistrict t")
public class ShtDistrict implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	private int id;
	private String name;
	private ShtProvince province;
	private ShtCity city;
	
	
	public ShtDistrict() {
	}
	
	public ShtDistrict(int id) {
		this.id = id;
	}

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}


	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	// JPA 基于USER_ID列的多对一关系定义
	@ManyToOne
	@JoinColumn(name = "pid")
	@JsonIgnore
	public ShtProvince getProvince() {
		return province;
	}

	public void setProvince(ShtProvince province) {
		this.province = province;
	}

	// JPA 基于USER_ID列的多对一关系定义
	@ManyToOne
	@JoinColumn(name = "cid")
	@JsonIgnore
	public ShtCity getCity() {
		return city;
	}

	public void setCity(ShtCity city) {
		this.city = city;
	}


}
